#ifndef NANE_ZIPFILEDEFLATED_H
#   define NANE_ZIPFILEDEFLATED_H

#   include "nane/FileArchiveSystem/ZIP/ZIPFileBase.h"

#   include <vector>

#   include "nane/thirdparty/zlib/zlib.h"

namespace nane
{
    
    class ZIPFileDeflated
        : public Disposable<ZIPFileDeflated, ZIPFileBase>
    {
    public:
        ZIPFileDeflated( ZIPFileArchive* _creator, const InputSeekablePtr& _input, uint32 _beginPos, uint32 _size, uint32 _uncompressedSize );
        ~ZIPFileDeflated();
        
        bool Initialize();
        void Shutdown();
        
    public:
        uint32 Read( byte* _buffer, uint32 _count );
        void Seek( uint32 _pos );
        uint32 Tell();
        uint32 Size() const;
        
    private:
        uint32 m_uncompressedSize;
        uint32 m_currentFilePos;
        std::vector<byte> m_inBuffer;
        uint32 m_inBufferSize;
        z_stream m_zStream;
        bool m_initialized;
        uint32 m_uncompressedPos;
    };
    
}   // namespace nane

#endif  // NANE_ZIPFILEDEFLATED_H
